<template>
  <ep-advance-card title="多页面Demo" theme="theme-1">
    测试:<ep-input type="text" v-model="input" />
    <template v-if="$route.params.id"> 多页面Demo：{{ $route.params.id }} </template>
    <template v-else>
      <ep-button @click="handleReplace">关闭本页面并跳转详情</ep-button>
    </template>
    <ep-button @click="handleClose">关闭本页面</ep-button>
  </ep-advance-card>
</template>

<script>
export default {
  data() {
    return {
      input: '测试keep-alive'
    }
  },
  mounted() {
    this.input = '测试keep-alive' + (this.$route.params.id || '')
  },
  methods: {
    handleReplace() {
      this.$app.$emit('replace-tab', {
        path: 'multiPageDemo/3'
      })
    },
    handleClose() {
      this.$app.$emit('close-tab')
    }
  }
}
</script>

<style></style>
